﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace HelperTool
{
    public class ClassSkillConversion
    {
        public const string ActionName = "Class Skill Conversion";        

        public static string DoStuff(string input)
        {
            // Barbarian, Acrobatics (Dex), Climb (Str), Craft (Int), Handle Animal (Cha), Intimidate (Cha), Knowledge (nature) (Int), Perception (Wis), Ride (Dex), Survival (Wis), Swim (Str).

            var inputList = input.Split(',');
            
            var doc = new XmlDocument();
            var listElement = doc.CreateElement("ClassSkillList");
            doc.AppendChild(listElement);
            
            listElement.SetAttribute("ClassName", inputList[0]);
            for (int i = 1; i < inputList.Length; i++)
            {
                var str = inputList[i].Replace(" ","");                
                var skillName = str.Replace(str.Substring(str.Length - 5, 5), "");

                var skillElement = doc.CreateElement("ClassSkill");
                skillElement.SetAttribute("Name", skillName);                                
                listElement.AppendChild(skillElement);
            }
            
            return doc.OuterXml;
        }
    }


}
